package member;

import java.io.*;

import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.struts.action.*;
import org.apache.struts.upload.*;

public class MemberForm extends ActionForm {
	
	private String mid = null;
	private String mname = null;
	private String mpass = null;
	private String lvno = null;
	
	private String mbirth = null;
	private String mbirthy = null;
	private String mbirthm = null;
	private String mbirthd = null;
	
	private String memail = null;
	private String maddresso = null;
	private String maddressh = null;
	private String mphoneo = null;
	private String mphoneh = null;
	private String mintro = null;
	
	private FormFile mphoto = null;
	private String mphotoofn = null;
	private String mphotosfn = null;
	private String mregdate = null;
	
	private String mobirth;
	private String moemail;
	private String moaddresso;
	private String moaddressh;
	private String mophoneo;
	private String mophoneh;
	private String mointro;
	private String mophoto;
	private String momailing;
	
	
	public String getLvno() {
		return lvno;
	}
	public void setLvno(String lvno) {
		this.lvno = lvno;
	}
	public String getMaddressh() {
		return maddressh;
	}
	public void setMaddressh(String maddressh) {
		this.maddressh = maddressh;
	}
	public String getMaddresso() {
		return maddresso;
	}
	public void setMaddresso(String maddresso) {
		this.maddresso = maddresso;
	}
	public String getMbirth() {
		return mbirth;
	}
	public void setMbirth(String mbirth) {
		this.mbirth = mbirth;
	}
	public String getMbirthd() {
		return mbirthd;
	}
	public void setMbirthd(String mbirthd) {
		this.mbirthd = mbirthd;
	}
	public String getMbirthm() {
		return mbirthm;
	}
	public void setMbirthm(String mbirthm) {
		this.mbirthm = mbirthm;
	}
	public String getMbirthy() {
		return mbirthy;
	}
	public void setMbirthy(String mbirthy) {
		this.mbirthy = mbirthy;
	}
	public String getMemail() {
		return memail;
	}
	public void setMemail(String memail) {
		this.memail = memail;
	}
	public String getMid() {
		return mid;
	}
	public void setMid(String mid) {
		this.mid = mid;
	}
	public String getMintro() {
		return mintro;
	}
	public void setMintro(String mintro) {
		this.mintro = mintro;
	}
	public String getMname() {
		return mname;
	}
	public void setMname(String mname) {
		this.mname = mname;
	}
	public String getMoaddressh() {
		return moaddressh;
	}
	public void setMoaddressh(String moaddressh) {
		this.moaddressh = moaddressh;
	}
	public String getMoaddresso() {
		return moaddresso;
	}
	public void setMoaddresso(String moaddresso) {
		this.moaddresso = moaddresso;
	}
	public String getMobirth() {
		return mobirth;
	}
	public void setMobirth(String mobirth) {
		this.mobirth = mobirth;
	}
	public String getMoemail() {
		return moemail;
	}
	public void setMoemail(String moemail) {
		this.moemail = moemail;
	}
	public String getMomailing() {
		return momailing;
	}
	public void setMomailing(String momailing) {
		this.momailing = momailing;
	}
	public String getMophoneh() {
		return mophoneh;
	}
	public void setMophoneh(String mophoneh) {
		this.mophoneh = mophoneh;
	}
	public String getMophoneo() {		
		return mophoneo;
	}
	public void setMophoneo(String mophoneo) {
		this.mophoneo = mophoneo;
	}
	public String getMophoto() {
		return mophoto;
	}
	public void setMophoto(String mophoto) {
		this.mophoto = mophoto;
	}
	public String getMointro() {
		return mointro;
	}
	public void setMointro(String mointro) {
		this.mointro = mointro;
	}
	public String getMpass() {
		return mpass;
	}
	public void setMpass(String mpass) {
		this.mpass = mpass;
	}
	public String getMphoneh() {
		return mphoneh;
	}
	public void setMphoneh(String mphoneh) {
		this.mphoneh = mphoneh;
	}
	public String getMphoneo() {
		return mphoneo;
	}
	public void setMphoneo(String mphoneo) {
		this.mphoneo = mphoneo;
	}
	public FormFile getMphoto() {
		return mphoto;
	}
	public void setMphoto(FormFile mphoto) {
		this.mphoto = mphoto;
	}
	public String getMphotoofn() {
		return mphotoofn;
	}
	public void setMphotoofn(String mphotoofn) {
		this.mphotoofn = mphotoofn;
	}
	public String getMphotosfn() {
		return mphotosfn;
	}
	public void setMphotosfn(String mphotosfn) {
		this.mphotosfn = mphotosfn;
	}
	public String getMregdate() {
		return mregdate;
	}
	public void setMregdate(String mregdate) {
		this.mregdate = mregdate;
	}

	/**
	 * signin validation
	 * */
	public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();		
		
		if(this.memail==null||this.memail.equals("")){
			errors.add("error.memail",new ActionMessage("이메일이 누락되었습니다.",false));
		} else {
			if(this.memail.indexOf("@")==-1){
				errors.add("error.memail", new ActionMessage("이메일 형식이 잘못되었습니다.",false));
			}
		}
		if(this.mphoto!=null){
			if(this.mphoto.getFileSize()>1024*500){
				errors.add("error.filesize", new ActionMessage("500KB 이하로 줄여주세요.",false));
			}	
		}
			
		return errors;
	}
	
}
